--[[ 编码: WMS-01-14 名称: 容器-重置空满状态 作者:HAN 日期:2025-01-29 级别:固定 (说明本段代码在项目中不太会变化) 函数: ResetEmptyFull 功能: 设置容器的空满状态 更改记录: --]] wms_cntr= require( "wms_container" ) function ResetEmptyFull ( strLuaDEID ) local nRet, strRetInfo -- step1 获取当前点中的容器 nRet, objs = m3.GetSysDataJson( strLuaDEID ) if ( nRet ~=0 ) then lua.Error( strLuaDEID, debug.getinfo(1), objs ) end -- [{"id":"","attrs":[{"attr":"","value":""},..]},..] local nCount = #objs if (nCount == 0) then return end local strJson nRet, strJson = mobox.objAttrsToLuaJson( "Container", lua.table2str(objs[1].attrs) ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "objAttrsToLuaJson Supplier 失败!"..strJson ) end local cntr success, cntr = pcall( json.decode, strJson ) if ( success == false ) then lua.Error( strLuaDEID, debug.getinfo(1), "objAttrsToLuaJson 返回的的JSON格式不合法!" ) end if ( cntr.type == nil ) then mobox.setInfo( strLuaDEID, "在列表定义里加上容器的类型!") return end local container nRet, container = wms_cntr.GetInfo( strLuaDEID, cntr.code ) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "wms_cntr.GetInfo 失败!"..container ) end wms_cntr.Reset( strLuaDEID, container ) local action = { { action_type = "refresh_cur_row", value = "" } } nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action)) if ( nRet ~= 0 ) then lua.Error( strLuaDEID, debug.getinfo(1), "setAction错误: "..strRetInfo) end end